Shared Memory

One of the most common ways to share information between Windows applications is shared memory. EVEREST Ultimate Edition hardware monitoring module uses the shared memory named EVEREST_SensorValues


The shared memory content is a long string value closed with a 0x00 char, making it a classic PChar or char*

The string is made of XML tags, but it's not a complete XML document. It includes all temperature, cooling fan and voltage values EVEREST measures. Temperatures are always in Celsius, regardless of the Fahrenheit display setting in EVEREST Preferences. Sensor value labels are always in English, they're not localized.

The buffer size (ie. the size of the shared memory block) should be at least 10 KB. A typical buffer size is around 1 to 3 KB, but for e.g. Abit MicroGuru 2005 based boards it can be a lot more.

The shared memory content can be read by using a similar code like the following Delphi procedure:


Const

sharedmem_name = 'EVEREST_SensorValues';

Function ExtApp_SharedMem_ReadBuffer(bu:PChar;bu_size:DWord):Boolean;

Var

mappedData : PChar;

th : THandle;

Begin

Result:=False;


th:=OpenFileMapping(FILE_MAP_READ,False,sharedmem_name);


If th<>INVALID_HANDLE_VALUE Then

Begin


mappedData:=MapViewOfFile(th,FILE_MAP_READ,0,0,0);


If mappedData<>Nil Then


Begin



StrLCopy(bu,mappedData,bu_size);



If UnmapViewOfFile(mappedData) Then Result:=True;


End;


CloseHandle(th);

End;
End;


An example output for the shared memory content:

extapp_sharedmem